<?php
namespace app\web\validate;

use think\Validate;

/**
 * 行为验证器
 * @package app\menus\validate
 * @author
 */
class Room extends Validate
{
    //定义验证规则
    protected $rule = [
        'room_id|房间'  => 'require',
        'project_id|项目'  => 'require',
        'engineer_id|技师'  => 'require',
        'time|预约时间' =>'require',
        'delay|预留时间' =>'require',
        'is_call|call钟' =>'require',
        'product_id|商品ID' =>'require',
        'product_name|商品名称' =>'require',
        'product_price|商品价格' =>'require',
        'discount|商品折扣' =>'require',

        'name|房间名称' =>'require',
        'desc|房间描述' =>'require',
        'type_id|房间类型' =>'require',
        'bed_num|床位' =>'require',
        'toilet|卫生间' =>'require',
        'clean_rule|净房规则' =>'require',
        'clean_price|净房提成' =>'require',
        'book_room|订房规则' =>'require',
        'book_price|订房提成' =>'require',
        'interval_time|间隔时间' =>'require',
    ];
    //定义验证提示
    protected $message = [
        'room_id.require' => '房间必须填写',
        'project_id.require' => '请选择项目',
        'engineer_id.require' => '请选择技师',
        'time.require' => '请填写时间',
        'delay.require' => '延迟时间必须填写',
        'is_cal.require' => '是否call钟',
        'product_name.require' => '请填写商品名称',
        'product_price.require' => '请填写商品价格',
        'discount.require' => '请填写折扣',

        'name.require' => '请填写房间名称',
        'desc.require' => '请填写描述',
        'type_id.require' => '请填写房间类型',
        'bed_num.require' => '请填写床位',
        'toilet.require' => '请填写卫生间',
        'clean_rule.require' => '请填写净房规则',
        'clean_price.require' => '请填写净房提成',
        'book_room.require' => '请填写订房规则',
        'book_price.require' => '请填写订房提成',
        'interval_time.require' => '请填写间隔时间',
    ];
    //定义验证场景
    protected $scene = [
        'add'   =>  ['room_id','project_id','engineer_id','time','delay','is_call'],
        'add_room'   =>  ['name','type_id','bed_num','toilet','clean_rule'],
        'cart'   =>  ['room_id','goods'],
    ];
}
